/*
 * DateUtils.java
 *
 * Created on 12/11/2011, 14:16
 */
package org.acervus.helpers;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Eziel Soares, Giordano Giuliano, Lenilson Regis
 */

public class DateUtils {
    private String dataIso;
    private String dataBr;
    private String[] splitter;
    private String dataAtual;
    
    public DateUtils(Date data) {
       SimpleDateFormat formatoBr = new SimpleDateFormat("dd/MM/yyyy");
       
       try {  
          Date novaData = formatoBr.parse(data.toString());  
          this.dataAtual = formatoBr.format(novaData);  
       } catch (ParseException Ex) { } 
    }
    
    public DateUtils(String data) { // 23/01/1989
        splitter = data.split("/");
        
        this.dataIso = splitter[2] + "-" + splitter[1] + "-" + splitter[0]; // 1989-01-23
        this.dataBr = data;
    }
    
    public String getDataISO() {
        return this.dataIso;
    }
    
    public String getDataBr() {
        return this.dataBr;
    }
    
    public String getDataAtual() {
        return this.dataAtual;
    }
} 